package com.qf.micrograss.grass.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.common.core.entity.GrassInfo;
import com.qf.micrograss.grass.param.LikeNumParam;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * --- 缘分让我们相遇乱世以外 ---
 *
 * @author SJY
 * 2025/1/4
 */
public interface GrassMapper extends BaseMapper<GrassInfo> {

    @Update("update grass_info set like_num = like_num + #{num} where id = #{id}")
    void updateLikeNum(@Param("id") Integer id, @Param("num") Integer num);

    //批量更新点赞数量
    void updateLikeNumBatch(List<LikeNumParam> list); // 可以使用@Param定义一个名称
}
